package com.wpp.controller;


import com.wpp.constant.SessionConstant;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;

@Controller
@RequestMapping("/login/api")
public class LoginController {

    @RequestMapping(value = "/toLogin")
    public String login(HttpServletRequest request, String userName, String password) {
        if ("admin".equals(userName) && "admin".equals(password)) {
            HttpSession session = request.getSession();
            session.setAttribute(SessionConstant.SESSION_USER_NAME,userName);
            return "redirect:/resume/api/list";
        }
        return "login";
    }

   /* @RequestMapping("/toLogin")
    public String toLogin() {

        return "login";
    }*/
}
